package com.bw.z.mvp.view.live.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.blankj.utilcode.util.TimeUtils;
import com.bw.z.R;
import com.bw.z.mvp.model.entity.LiveCommentEntity;
import com.bw.z.network.Api;
import com.bw.z.utils.GlideUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.tb.emoji.EmojiUtil;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.util.Date;

public class LiveCommentAdapter extends BaseQuickAdapter<LiveCommentEntity.Values, BaseViewHolder> {
    public LiveCommentAdapter() {
        super(R.layout.item_comment);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, LiveCommentEntity.Values values) {
        baseViewHolder.setText(R.id.comment_item_fabulous_tv, "101");
        baseViewHolder.setText(R.id.comment_item_name_tv, "" + values.user_name);
        Date date = new Date(values.comment_time * 1000);
        String str = TimeUtils.getFriendlyTimeSpanByNow(date);
        baseViewHolder.setText(R.id.comment_item_time_tv, "" + str);
        baseViewHolder.setText(R.id.comment_item_address_tv, "天津");
        TextView comment_item_values_tv = baseViewHolder.getView(R.id.comment_item_values_tv);
        try {
            EmojiUtil.handlerEmojiText(comment_item_values_tv, values.comment_value, getContext());
        } catch (IOException e) {
            e.printStackTrace();
        }
        ImageView headImg = baseViewHolder.getView(R.id.comment_item_head_img);
        GlideUtils.getInstance().GlideImageUrl(R.mipmap.maomao, headImg);
    }
}
